<?php
  include_once("../sql_connect.php");
  include_once("../msg_redirect.php");
?>
<?php 
/*转发代码*/

/*转发微博编号*/
$t_id=$_POST[w_id];

/*Ajax调用此模块将微博写入数据库*/
$my_sql = mysql_query ( "select MAX(w_id) from weibo", $connection ); /*检查weibo表中得最大weibo编号*/
$my_result = mysql_fetch_array ( $my_sql );

/*对将要输入weibo表的数据项量进行赋值*/
$w_id = $my_result [0] + 1;
$w_content = $_POST[t_content];
$u_no = $_COOKIE ['u_no'];
$w_date = time();

/*u_no者的微博数加一*/
$my_sql1 = mysql_query ( "select MAX(w_num) from weibo where u_no='$u_no'", $connection ); /*检查weibo表中得w_num最大序号*/
$my_result1 = mysql_fetch_array ( $my_sql1 );
$w_num = $my_result1 [0] + 1;


/*转发微博的转发数加一*/

if($t_id !=""){
	do{
    	$my_sql2 = mysql_query ( "UPDATE weibo SET t_times =t_times +1 WHERE w_id='$t_id' ", $connection ); /*检查weibo表中得t_times最大序号*/
        $weibo_sql= mysql_query("SELECT t_id FROM weibo WHERE w_id='$t_id' ");
        $weibo_result2= mysql_fetch_array($weibo_sql);
    }while($t_id =$weibo_result2[0]);
}

$t_id=$_POST[w_id];
        
/*插入数据*/
$my_sql = mysql_query ( "insert into weibo values('$w_id','$w_content','$u_no','$w_date','$t_id','','','$w_num')", $connection );
return;

?>